//package com.study.spring.security.service;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Service;
//
////@Service
//// UserDetailsService ：用来加载用户信息
//// User ： security 提供的一个user顶层bean。开发可以自己搞个userBean 继承这个USER顶层Bean
//public class LuUserDetailsServiceImpl implements UserDetailsService {
//
//    @Autowired
//    // 用密码加密的方式
//    private PasswordEncoder passwordEncoder;
//
//    @Override
//    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
//        //String hashpw = BCrypt.hashpw("123456", BCrypt.gensalt());
//        UserDetails userDetails = User.withUsername("user")
//                .password(passwordEncoder.encode("123456"))
//                .authorities("admin")
//                .build();
//        return userDetails;
//
//    }
//}
